package com.mipo.observer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
@Component
public class TaskPublisher implements ApplicationEventPublisher {
	private ApplicationEventPublisher publisher;
	@Override
	public void publishEvent(ApplicationEvent event) {
		publisher.publishEvent(event);
	}
	@Override
	public void publishEvent(Object o) {
		TaskEvent event = new TaskEvent(o);
		System.out.println(publisher == this);
		System.out.println(publisher);
		publisher.publishEvent(event);
		
	}
	@Autowired
	public void setApplicationEventPublisher(ApplicationEventPublisher publisher) {
		this.publisher = publisher;
	}
}
